Environment

Domain: claritysystems.work → Cloudflare Pages → repo iamanoob2024/claritysystems-lobby All source files on Mac at /Users/mac/Desktop/claritysystems-lobby/ Cloudflare Pages watches the repo and auto-deploys on every push to main No local Wrangler — Mac is OS X 10, too old. All Workers deploy via GitHub Actions Node v20.20.2, npm v10.8.2, git v2.24.3

Workers

cac-leads → lead capture → Google Sheet (1DJHfOWVR870GSW9gkM3O5JgqYp4_aEYWfXNKHhsPd-s) via Apps Script → tabs per course cac-corporate-enquiry → corporate enquiry → needs full automation build (see below) Both Workers: secrets TELEGRAM_BOT_TOKEN + TELEGRAM_CHAT_ID (set on cac-corporate-enquiry, needs adding to cac-leads) Email via Resend

Big picture — what exists and what's next

DONE (enquiry flow)

NEXT: Stripe payment flow

This is a separate trigger. When a client pays via Stripe, Stripe fires a webhook to a Worker (either the same Worker on a /stripe-webhook route, or a new Worker). That webhook:

  1. Receives payment_intent.succeeded or checkout.session.completed event
  2. Looks up the customer email in D1 to get their enquiry record
  3. Pulls the confirmed date from the Stripe session metadata (you pass it when creating the checkout link)
  4. Fetches template-course-schedule.html from R2
  5. Injects confirmed date (not tentative — actual day1_date and day2_date)
  6. Renders PDF via Puppeteer
  7. Fetches trainer_profile.pdf from R2
  8. Sends email via Resend with 3 attachments: confirmed course schedule, trainer profile, proforma invoice (already generated — retrieve from R2 proformas/ folder where it was saved)
  9. Updates D1 interaction row with payment confirmed status
  10. Fires Telegram notification

Dependencies you need before building Stripe flow:

What needs to be built:

The cleanest sequence when you're ready:

  1. Create Stripe product + price
  2. Add Stripe keys to Worker secrets via GitHub Actions env or wrangler secret put
  3. Add /stripe-webhook route to existing Worker
  4. Build checkout session creator (simple endpoint, takes email + date + pax, returns Stripe URL)
  5. Test end-to-end: pay → webhook fires → confirmed PDF → email lands

For next session — state to remember: